package com.wushi.lenovo.asia5b.app_di.profile.presenter;

import com.mvp.base.BasePresenter;
import com.wushi.lenovo.asia5b.app_di.profile.mvpview.ShipAddressActivityView;
import com.wushi.lenovo.asia5b.app_http.ApiService;
import com.wushi.lenovo.asia5b.app_model.other.UserInfo;

import javax.inject.Inject;


public class ShipAddressActivityPresenter extends BasePresenter<ShipAddressActivityView> {

    ApiService apiService;

    @Inject
    public ShipAddressActivityPresenter(ApiService apiService) {
        this.apiService = apiService;
    }

    public void getAddresses() {
        baseSubscribe(apiService.getAddresses(UserInfo.getMemberId())
                , addressResModelResultModel -> {
                    getView().getAddressesResult(addressResModelResultModel);
                });
    }

    public void deleteAddress(int address_id) {
        baseSubscribe(apiService.deleteAddress(address_id)
                , resultModel -> {
                    getView().deleteAddressResult(resultModel);
                });
    }


}